package mwt.xml.xdbforms.dbms;

import javax.xml.parsers.ParserConfigurationException;
import mwt.xml.xdbforms.dbms.metadata.MetadataManager;
import mwt.xml.xdbforms.dbms.query.QueryManager;
import mwt.xml.xdbforms.xforms.XFormsModelManager;
import mwt.xml.xdbforms.xforms.XFormsUIManager;

public abstract class XDBFManager {
    
    private static XDBFManager instance = null;
    
    protected XDBFManager() {}

    public synchronized static void setInstance(XDBFManager manager) {
        if (instance != null) {
            throw new RuntimeException();
	}
	instance = manager;

    }

    public synchronized static XDBFManager getManager() {
        if (instance == null) {
            throw new RuntimeException();
	}

        return instance;
    }

    public abstract boolean connect(String username, String password);

    public abstract void disconnect();

    public abstract MetadataManager getMetadataManager();

    public abstract QueryManager getQueryManager();

    public abstract XFormsModelManager getXFormsModelManager() throws ParserConfigurationException;

    public abstract XFormsUIManager getXFormsUIManager() throws ParserConfigurationException;
}
